#!/usr/bin/env python3

from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration

def generate_launch_description():
    # 声明启动参数
    use_draco_compression_arg = DeclareLaunchArgument(
        'use_draco_compression',
        default_value='true',
        description='是否启用Draco点云压缩'
    )
    
    draco_compression_level_arg = DeclareLaunchArgument(
        'draco_compression_level',
        default_value='10',
        description='Draco压缩级别 (0-10, 10为最高压缩比)'
    )
    
    # WebRTC节点
    webrtc_node = Node(
        package='webrtc_package',
        executable='ros_webrtc_node',
        name='ros_webrtc_node',
        parameters=[{
            'use_draco_compression': LaunchConfiguration('use_draco_compression'),
            'draco_compression_level': LaunchConfiguration('draco_compression_level'),
        }],
        output='screen'
    )
    
    return LaunchDescription([
        use_draco_compression_arg,
        draco_compression_level_arg,
        webrtc_node
    ])
